/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.jasoet.swing.cellrenderer;

import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;
import khannedy.blogging.masterdetail.entity.Mahasiswa.JenisKelamin;

/**
 *
 * @author Deny Prasetyo
 */
public class JenisKelaminTableCellRenderer extends DefaultTableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        JLabel component = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        component.setHorizontalAlignment(SwingConstants.CENTER);
        JenisKelamin jk = (JenisKelamin) value;
        if (jk == JenisKelamin.LakiLaki) {
            component.setText("Laki-Laki");
        } else {
            component.setText("Perempuan");
        }
        return component;
    }
}
